package bounce;

import java.util.ArrayList;

/**
 * Class to represent a nesting shape that contains other shape objects
 * 
 * @author Ken Neth Yeoh
 *
 */

public class NestingShape extends Shape {
	
	private ArrayList<Shape> shapes;

	public NestingShape(int x, int y, int deltaX, int deltaY, int width, int height) {
		super(x, y, deltaX, deltaY, width, height);
		shapes = new ArrayList<Shape>();
	}
	
	public void add(Shape newShape) {
		shapes.add(newShape);
	}
	
	public void move(int width, int height) {
		super.move(width, height);
		for(Shape s : shapes) {
			s.move(fWidth, fHeight);
		}
	}
	
	@Override
	public void paint(Painter painter) {
		// TODO Auto-generated method stub
		painter.translate(fX, fY);
		for(Shape s : shapes) {
			s.paint(painter);
		}
		painter.translate(-fX, -fY);
		//painter.drawRect(fX, fY, fWidth, fHeight);
	}
}
